Skip to content

feat(builder): add pre-seal validation hooks and schema compliance checks#185

Merged
gerchowl merged 1 commit intodevfrom
feature/0-preseal-validation
Mar 30, 2026
Merged

feat(builder): add pre-seal validation hooks and schema compliance checks#185
gerchowl merged 1 commit intodevfrom
feature/0-preseal-validation

Conversation

@gerchowl
Copy link
Copy Markdown
Contributor

Summary

  • Extend _validate() in Fd5Builder with JSON schema compliance checking, description quality warnings (non-blocking), and product-specific validation via duck-typed validate() method
  • Add pre_seal_hooks parameter to create() for user-defined validation/inspection hooks called before sealing
  • Add check_descriptions_file() to quality.py for checking description quality on open HDF5 files
  • Make _walk() in quality.py resilient to external links that cannot be resolved

Test plan

  • test_schema_validation_catches_missing_dataset -- schema requires 'values' group, not written, seal raises Fd5ValidationError
  • test_schema_validation_passes_valid_file -- normal create + seal works
  • test_description_quality_warns_short -- short description triggers UserWarning
  • test_description_quality_does_not_block -- short description still seals successfully
  • test_product_validate_method_called -- schema with custom validate() is called during seal
  • test_product_validate_can_reject -- schema validate() raises, seal aborts
  • test_pre_seal_hooks_called -- hook called with open h5py.File
  • test_pre_seal_hook_can_abort -- hook raises, seal aborts, temp file cleaned up
  • test_no_hooks_default -- default behavior unchanged
  • All 57 tests in test_create.py + test_preseal_validation.py pass
  • 1121 tests pass in full suite (pre-existing mip_coronal failures excluded)

🤖 Generated with Claude Code

…ecks

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gerchowl gerchowl merged commit fb7da7a into dev Mar 30, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant